//
//  DiarySubViewCell.m
//  e家园设计
//
//  Created by 愉乐 on 15/4/14.
//  Copyright (c) 2015年 lanou3g.com. All rights reserved.
//

#import "DiarySubViewCell.h"

@implementation DiarySubViewCell
//-(void)prepareForReuse{
//    self.data.text = @"";
//    self.aimage.image = nil;
//}
- (void)dealloc
{
    [self.data release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    return self;
}



- (void)setTextOfMaterialLabel:(NSString *)text
{
    
    self.data = [[UILabel alloc] initWithFrame:CGRectMake(20, 5, self.frame.size.width - 20, 0)];
    [self.contentView addSubview:self.data];
    self.data.text = text;
    if (!self.data.text) {
        self.data.frame = CGRectZero;
    }
    else {
        NSLog(@"%@", self.data.text);
    }
    
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:16.0f]};
    CGRect rect = [self.data.text boundingRectWithSize:CGSizeMake(self.data.frame.size.width, 100000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.data.frame = CGRectMake(self.data.frame.origin.x, self.data.frame.origin.y, rect.size.width, rect.size.height + 20);
    self.data.numberOfLines = 0;
    self.data.font = [UIFont systemFontOfSize:16.0f];
    
    self.frame = self.data.frame;
    [self.data release];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
